/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package alex;

/**
 *
 * @author Administrador
 */
public class token {

    /* Variables de Instancia */
    public int token;
    public String lexema;
    public int NumeroLinea;

    /* Constantes para identificadar tokens   */
    public static final int IDENT = 0;
    public static final int OPSUMA = 1;
    public static final int OPRESTA = 2;
    public static final int OPMULT = 3;
    public static final int OPDIV = 4;
    public static final int OPAND = 5;
    public static final int OPOR = 6;
    public static final int OPNOT = 7;
    public static final int OPIGUAL = 8;
    public static final int OPDISTINTO = 9;
    public static final int OPMENOR = 10;
    public static final int OPMAYOR = 11;
    public static final int OPMENORIG = 12;
    public static final int OPMAYORIG = 13;
    public static final int PARABRE = 14;
    public static final int PARCIERRA = 15;
    public static final int OPASIG = 16;
    public static final int PUNTO = 17;
    public static final int COMA = 18;
    public static final int PTOCOMA = 19;
    public static final int DOSPTOS = 20;
    public static final int ARRAY = 21;
    public static final int IF = 23;
    public static final int THEN = 24;
    public static final int ELSE = 25;
    public static final int OF = 26;
    public static final int WHILE = 27;
    public static final int BEGIN = 29;
    public static final int END = 30;
    public static final int CONST = 31;
    public static final int VAR = 32;
    public static final int TYPE = 33;
    public static final int FUNCTION = 34;
    public static final int PROCEDURE = 35;
    public static final int PROGRAM = 36;
    public static final int NUMERO = 37;
    public static final int ESPACIO = 38;

    //public static final int COMENTARIO=40;

    /* Consultas */
    static public String getToken(token t) {
        switch (t.token) {
            case IDENT:
                return "Identificador: " + t.lexema;
            case OPSUMA:
                return "Operador suma/Signo '+'";
            case OPRESTA:
                return "Operador resta/Signo '-'";
            case OPMULT:
                return "Operador multiplicacion '*'";
            case OPDIV:
                return "Operador division entera 'div'";
            case OPAND:
                return "Operador AND";
            case OPOR:
                return "Operador OR";
            case OPNOT:
                return "Operador NOT";
            case OPIGUAL:
                return "Operador =";
            case OPDISTINTO:
                return "Operador <>";
            case OPMENOR:
                return "Operador <";
            case OPMAYOR:
                return "Operador >";
            case OPMENORIG:
                return "Operador <=";
            case OPMAYORIG:
                return "Operador >=";
            case PARABRE:
                return "Parentesis que abre '('";
            case PARCIERRA:
                return "Parentesis que cierra ')'";
            case OPASIG:
                return "Asignacion ':='";
            case PUNTO:
                return "Punto '.'";
            case COMA:
                return "Coma ','";
            case PTOCOMA:
                return "Punto y coma ';'";
            case DOSPTOS:
                return "Dos Puntos ':'";
            case ARRAY:
                return "Palabra reservada ARRAY";
            case IF:
                return "Palabra reservada IF";
            case THEN:
                return "Palabra reservada THEN";
            case ELSE:
                return "Palabra reservada ELSE";
            case OF:
                return "Palabra reservada OF";
            case WHILE:
                return "Palabra reservada WHILE";
            case BEGIN:
                return "Palabra reservada BEGIN";
            case END:
                return "Palabra reservada END";
            case CONST:
                return "Palabra reservada CONST";
            case VAR:
                return "Palabra reservada VAR";
            case TYPE:
                return "Palabra reservada TYPE";
            case FUNCTION:
                return "Palabra reservada FUNCTION";
            case PROCEDURE:
                return "Palabra reservada PROCEDURE";
            case PROGRAM:
                return "Palabra reservada PROGRAM";
            case NUMERO:
                return "Numero Entero: " + t.lexema;
            // case 40: return "COMENTARIO";
            case ESPACIO:
                return "Espacio";
        } // switch
        return "";
    }

    public void setNroLinea(int num) {
        NumeroLinea = num;
    }

    public token(int Tok, String Lex) {
        token = Tok;
        lexema = Lex;
    }
}